'use strict';
// 换取用户标识信息
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let url = 'https://api.weixin.qq.com/sns/jscode2session'
	let js_code = event.code
	let result = await uniCloud.httpclient.request(url,{
		method: 'GET',
		data: {
			appid: 'wx4d2cd8debcd75ba5',
			secret: '159c353fd3072419056b8c427d8258e4',
			js_code,
			grant_type: 'authorization_code'
		},
		contentType: 'json',
		dataType: 'json'
	})
	//返回数据给客户端
	return result.data
};
